<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script type="text/javascript">
	var keyword = null;
	function setSelectItem(id){
		keyword = id;

	}

	//装修初验
	function openFirstInspection(){
		var hasReinspection = '${ctx}/renovation_inspectionRequisitionAction.do?method=hasReinspection&keyword='+keyword;
		new Ajax.Request(hasReinspection,{method: 'post' ,onSuccess : function(response){
			//alert(response.responseText);
			if(response.responseText == 'true'){
				Alert('已经存在复验！');
				}
			else{
			var url = "${ctx}/renovation_firstInspectionAction.do?method=editPage&inspectionRequisitionId="+keyword;
			top.windowOpen(url, 'firstInspection', '竣工初验管理', 280, 750);
			}
		}});
	}

	function itemAdd(){
	      var url = "${ctx}/renovation_inspectionRequisitionAction.do?method=addPage";
	      top.windowOpen(url, "inspectionRequisitionAdd", "新建竣工验收申请", 300, 800,true,"inspectionRequisitionAddifm");
	}
	//装修复验
	function openReinspection(){
		var hasFirstInspection = '${ctx}/renovation_inspectionRequisitionAction.do?method=hasFirstInspection&keyword='+keyword;
		new Ajax.Request(hasFirstInspection,{method: 'post' ,onSuccess : function(response){
			//alert(response.responseText);
			if(response.responseText == 'false'){
				var url = "${ctx}/renovation_reinspectionAction.do?method=queryReinspectionList&isReinspection=1&inspectionRequisitionId="+keyword;
				top.windowOpen(url, 'ReinspectionList', '竣工复验管理', 540, 800,true,'ReinspectionListIForm');
			}
			else{
				Alert('还未进行初验！');
			}
		}});
	}

	function itemEdit(tag){
	 	if(keyword == null){
	 	   	Alert('请选择数据！');
	      return false;
	 	  }

			var hasFirstInspection = "${ctx}/renovation_inspectionRequisitionAction.do?method=hasFirstInspection";

			new Ajax.Request(hasFirstInspection,
			         { method:'post',
					   parameters:{keyword:keyword},
					   onComplete:function(response){
						if(response.responseText == 'false'){
							Alert('已经做了初验不能修改！');
						}else{
							var url = "${ctx}/renovation_inspectionRequisitionAction.do?method=editPage&keyword="+keyword;
	   						top.windowOpen(url, "inspectionRequisitionEdit", "编辑竣工验收申请", 300, 800);
					   }
					 }});
	}
	function itemDelete(){
	 	  if(keyword == null){
	 	   	Alert('请选择数据！');
	      return false;
	 	  }
	 	  else{
	    	AskConfirm("${key.tipsByDeleteConfirm}","main","deleteItem");
	 	  }
	}
	function deleteItem(){
		var url = '${ctx}/renovation_inspectionRequisitionAction.do?method=deleteInspectionRequisition&keyword='+keyword;
		new Ajax.Request(url,{method: 'post' ,onSuccess : showResponse});
	}


	function showResponse(response){
		ajaxSubmitException(response.responseText);
		if(response.responseText == "true" ){
			refresh();
		}

	}

	function refresh(){
		//alert("调用了！");
		keyword=null;
		$('inspectionRequisitionList').src="${ctx }/renovation_inspectionRequisitionAction.do?method=queryInspectionRequisitionByPage";
	}

	function search(){
		var url="${ctx}/renovation_inspectionRequisitionAction.do?method=setSearchPramCatch";
   		var parameters = Form.serialize('searchForm');
   		new Ajax.Request(url,{method: 'post', parameters: parameters, onComplete: showResponse});
	}

	//违规登记
	function openInspectionViolation(inspectionRequisitionId,firstInspectionId,isReinspection){
		var url = "${ctx}/renovation_firstInspectionAction.do?method=initInspectionViolation&inspectionRequisitionId="+inspectionRequisitionId +"&inspectionId=" + firstInspectionId;
		if(isReinspection){
			url = url + '&isReinspection=1'
		}
			top.windowOpen(url, "InspectionViolation", "违规登记", 580, 700);
	}

	//打开详细界面
	function openDetailPage(licenceId){//打开详细主页面
		var url = "${ctx}/renovation_inspectionRequisitionAction.do?method=showDetailPage&inspectionRequistionId=" + keyword +'&renovateLicenceID=' + licenceId;
   		top.windowOpen(url, "detailPage", "详细资料", 380,900);
	}


	function showSearch(){
		var url = "${ctx}/renovation_inspectionRequisitionAction.do?method=searchPage";
		top.windowOpen(url, "inspectionRequisitionSearch", "高级查询", 330, 550,true,'inspectionRequisitionSearchIfram');
	}

	function showCycleForward(){ //流程跳转
 		var url = "${ctx}/renovation_renovationForwordAction.do?method=renovationForwordSmall";
		top.windowOpen(url, "renovationForward", "装修流程", 320, 900);
	}
	function cycleForward(url){
   		window.location.href=url;
	}
</script>
<title>装修验收</title>
</head>
<body style="overflow: auto;">
<div class="pageNav_bg">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td id="pageNav_leftimg"><img src="${ctx}/images/ico_zxgl_zxys.gif" width="46" height="47" /></td>
		<td id="navWord"><span class="page_title">装修验收</span></td>
		<td class="pageNav_right">
		<a href="#" style="CURSOR: hand;" onFocus="javascript:showCycleForward();" onClick="showAdd2()"><img src="${ctx}/images/charage_buzhou11.gif" border="0"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<a href="javascript:showFull_in();"><img id="full_image" src="${ctx}/images/ico_fullscreen.gif" border="0" /></a>
		</td>
	</tr>
</table>
</div>
<div class="container">
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td>
		<form name="searchForm" method="post" action="${ctx}/renovation_inspectionRequisitionAction.do?method=queryRenovateViolationInfo" target="renovateViolationList">
          <table width="100%" border="0" cellpadding="0" cellspacing="0" id="search01" class="bg_search">
            <tr>
              <td ><table border="0" cellpadding="0" cellspacing="1">
                <tr>
                  <td class="grid align_left">楼 栋：</td>
                  <td class="td_search align_left">
                    <pms:unitedSelect
                        		name="buildingId"
                        		id="buildingId"
                        		optionLabel="name"
                        		optionValue="keyword"
                        		selectText="请选择..."
                        		dataList="${buildingList}"
                        		style="width:110px;">
                    </pms:unitedSelect>
                   </td>
				   <td class="grid align_left">房 号：</td>
                  <td class="td_search align_left">
                  	<input name="houseNumber" id="houseNumber" type="text" maxlength="10" class="inputtext" size="16" />
                  </td>
				  <td class="grid align_left">复验结果：</td>
                  <td class="td_search align_left">
                  <select name="reinspectionResult" id="reinspectionResult" style="width:110px;">
                    <option selected="selected" value="">请选择...</option>
                    <option value="004">通过</option>
					<option value="003">不通过</option>
                  </select>
                  </td>
				  <td class="td_search"><table border="0" onclick="javascript:search();"  cellpadding="0" cellspacing="0" >
                      <tr>
                        <td class="buttonOffLeft" id="btn1_111"></td>
                        <td class="buttonOffMiddle" id="btn1_112" onblur="btn_change(11)" onMouseOver="btn_change_over(11)" onMouseOut="btn_change_out(11)">
                        <img src="${ctx}/images/ico_searchico.gif" alt="" border="0" align="absmiddle" /> 查询
                        </td>
                        <td class="buttonOffRight" id="btn1_113"></td>
                      </tr>
                  </table></td>
				  <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onblur="btn_change(2)" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)">
              <a href="#" onFocus="this.blur()" onClick="javascript:showSearch();" style="color:#000;">高级查询</a></td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
          </table></td>
                  <td><table border="0" cellpadding="0" cellspacing="0">
                  </table></td>
                </tr>
              </table></td>
            </tr>
          </table>
          </form></td>
	</tr>
	<tr>

		<td class="bg_toolBar">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="25%">&nbsp;</td>
				<td width="75%" align="right">
				<table border="0" cellpadding="0" cellspacing="0" id="ico1">
					<tr>
					<pms:AuthTag authName="renovation_inspectionRequisitionAction.do?method=addInspectionRequisition">
						<td class="toolbarico"><a href="#" onClick="javascript:itemAdd();" onFocus="this.blur()"><img src="${ctx}/images/ico_newfile.gif" alt="添加" width="16" height="16" border="0" align="absbottom" />&nbsp;</a></td>
					</pms:AuthTag>
					<pms:AuthTag authName="renovation_inspectionRequisitionAction.do?method=editInspectionRequisition">
						<td class="toolbarico"><a href="#" onClick="javascript:itemEdit();" onFocus="this.blur()"><img src="${ctx}/images/ico_amend.gif" border="0" width="16" height="16" align="absbottom" alt="修改" />&nbsp;</a></td>
					</pms:AuthTag>
					<pms:AuthTag authName="renovation_inspectionRequisitionAction.do?method=deleteInspectionRequisition">
						<td class="toolbarico"><a href="#" onClick="javascript:itemDelete();" onFocus="this.blur()"><img src="${ctx}/images/ico_delete.gif" alt="删除" width="16" height="16" border="0" align="absbottom" /></a></td>
					</pms:AuthTag>
						<td class="toolbarico">&nbsp;</td>
					</tr>
				</table>

				</td>
			</tr>
		</table>
		</td>
	</tr>

	<tr>
		<td valign="top"><!--------------------------列表----------------------------------->
		<iframe src="${ctx }/renovation_inspectionRequisitionAction.do?method=initMainList" name="inspectionRequisitionList" id="inspectionRequisitionList" width="100%" height="auto" frameborder="0" scrolling="auto"> </iframe>
		</td>
	</tr>
</table>
</div>

</body>
</html>